import 'package:animated_interpolation/smart_tabbar.dart';
import 'package:animated_interpolation/sweet_indicator_painter.dart';
import 'package:coinbaby/common/alert/alert.dart';
import 'package:coinbaby/common/const/cosnt.dart';
import 'package:coinbaby/common/textstyle/textstyle.dart';
import 'package:coinbaby/page/autobuy/view/select_tab.dart';
import 'package:coinbaby/page/friend/view/friendcell.dart';
import 'package:flutter/material.dart';

class FriendPage extends StatefulWidget {

  @override
  _FriendPageState createState() => _FriendPageState();
}

class _FriendPageState extends State<FriendPage> with SingleTickerProviderStateMixin {

  TabController _tabController;
  int currTabIndex = 0;
  static const List<String> titles = ["快讯", "大V说", "私密圈"];

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 3, vsync: this);
  }

  @override
  void disopose() {
    _tabController.dispose();
    super.dispose();
  }
  
  TextStyle normalStyle(int index) {
    return index == currTabIndex ? AppFont.textStyle(18, AppColor.blue, fontWeight: FontWeight.bold) : AppFont.textStyle(15, AppColor.fontgrey);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          children: <Widget>[
            SelectTabView(
              tabController: _tabController,
              currentIndex: currTabIndex,
              titles: titles,
              onTap: (index){
                if(index > 0) {
                  Alert.showToast("即将上线，敬请期待");
                  return;
                }
                setState(() {
                  currTabIndex = index;
                });
              },
            ),
            Expanded(
              child: ListView.builder(
                itemCount: 2,
                padding: const EdgeInsets.only(top: 18),
                itemBuilder: (context, index){
                return FriendCell(index: index,);
              }),
            )
          ],
        ),
      ),
    );
  }
}